<?php

/**
 * Ignus Framework
 *
 * @author Sergey Palyanov <sergey.palyanov@gmail.com>
 * @link http://code.google.com/p/ignus-php/
 * @license http://apache.org/licenses/LICENSE-2.0
 * @package Ignus
 * @subpackage Test
 * @since 0.1
 */

namespace Ignus\Test\Report;

use Ignus\Test\AssertionException;

/**
 * @package Ignus
 * @subpackage Test
 * @since 0.1
 */
class TextReporter implements Reporter
{
    const LINE_WIDTH = 80;
    private $line;

    public function __construct()
    {
        $this->line = str_repeat('-', self::LINE_WIDTH) . "\n";
    }

    public function printHeader($caseName)
    {
        echo str_pad($caseName, self::LINE_WIDTH), "\n", $this->line;
    }

    public function printTestSuccess($testName)
    {
        echo ' * ', $testName, " - OK\n";
    }

    public function printTestFailure($testName, AssertionException $e)
    {
        echo ' * ', $testName, " - FAIL (", $e->getMessage(), " line ", $e->getLine(),")\n";
    }

	public function printFooter() {
        echo $this->line, "\n";
    }

	public function printTotals() {

    }

    public function printUnexpectedException($testName, \Exception $e)
    {
        echo ' * ', $testName, " - EXCEPTION (", $e->getMessage(), " line ", $e->getLine(),")\n";
    }
}
